#!/bin/bash

6_annotation/recover_missed.sh  /home/mixagol/work/data/annotation_cluster/NC_003454
6_annotation/annotate_missed.sh /home/mixagol/work/data/annotation_cluster/NC_003454

# если всё ок, то
6_annotation/clear_local_data.sh /home/mixagol/work/data/annotation_cluster/NC_003454
mv /home/mixagol/work/data/annotation_cluster/NC_003454 /home/mixagol/work/data/annotation_cluster_done_



for d in ~/work/data/annotation_cluster/NC_*; do
    echo -e $d"\t"$(ssh $(cat $d/worker_hostname) 'ps ax | grep '"$(basename $d)"' | grep -v grep | wc -l')
done \
    | awk '{if ($2==0) print $1}' \
    | xargs -n1 6_annotation/clear_local_data.sh


for d in ~/work/data/annotation_cluster/NC_*; do
    echo -e $(basename $d)"\t"$(ssh $(cat $d/worker_hostname) 'ps ax | grep '"$(basename $d)"' | grep -v grep | wc -l')"\t"$(cat $d/worker_hostname)
done \
    | grep quad \
    | awk '{if ($2==0) print $1}' \
    | xargs -n1 -I {} bash -c "echo {}; mpirun -q quad -np 1 ~/runner 6_annotation/prepare4new_org_remained.sh {}; sleep 3600"


for d in ~/work/data/annotation_cluster/NC_*; do
    echo -e $(basename $d)"\t"$(ssh $(cat $d/worker_hostname) 'ps ax | grep '"$(basename $d)"' | grep -v grep | wc -l')"\t"$(cat $d/worker_hostname)
done \
    | grep fs \
    | awk '{if ($2==0) print $1}' \
    | xargs -n1 -I {} bash -c "echo {}; mpirun -q fs -np 1 ~/runner 6_annotation/prepare4new_org_remained_fs.sh {}; sleep 3600"


